<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<title>Document</title>
	</head>
	<body>
		<div id="app">
			<h2>{{title}}</h2>
			<my-child></my-child>
		</div>

		<template id="child">
			<h2>{{title}}</h2>
		</template>
		<script src="./js/vue.js"></script>
		<script>
			// 1. 创建app实例
			const app = Vue.createApp({
				data() {
					return {
						title: '你好',
					}
				},
				components: {
					'my-child': {
						template: '#child',
						data() {
							return {
								title: 'my-child',
							}
						},
					},
				},
			})

			// 2. 挂载到#app上
			app.mount('#app')
		</script>
	</body>
</html>
